
///事件输出，作为日志记录
let errCount = 0;
const service = {
  //普通日志记录
  log: (...datas) => {
    return new Promise((resolve) => {
      resolve();
      console.log(...datas);
    });
  },

  //错误记录
  err: (...error) => {
    return new Promise((resolve) => {
      resolve();
      if (wx.reportMonitor){
        wx.reportMonitor('0', errCount++)
      }
      // wx.reportAnalytics(eventname, error.data)
      console.error(...error);
    });
  },

  //耗时记录
  time: (id) => {
    return new Promise((resolve) => {
      resolve();
      console.time(id);
    });
  },

  //耗时记录
  timeEnd: (id) => {
    return new Promise((resolve) => {
      resolve();
      console.timeEnd(id);
    });
  }
  
}


module.exports = service;